package com.wiley.utils;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;

import io.appium.java_client.android.AndroidDriver;

public class BaseSet {	
	public AndroidDriver<WebElement> driver;
	@BeforeClass
	@Parameters({ "port", "udid", "appPackage", "appActivity" })
	public void gestureLogin(String port,String udid, String appPackage, String appActivity) throws MalformedURLException, InterruptedException {
		System.out.println("port is: " + port + ", udid is: " + udid + ", appPackage is: " + appPackage + ", appActivity is : " + appActivity);
		DesiredCapabilities capabilities = new DesiredCapabilities();
		capabilities.setCapability("deviceName", "android emulator");
		capabilities.setCapability("udid", udid);
		capabilities.setCapability("appPackage", appPackage);
		capabilities.setCapability("appActivity", appActivity);
		capabilities.setCapability("noSign", "True");
		driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:" + port + "/wd/hub"), capabilities);
		Thread.sleep(6000);
	}

	@AfterClass
	public void teardown(){
		driver.quit();
	}
}
